import { requestInterceptor, responseInterceptor} from "./interceptor";
import axios from 'axios'

export const request = (config) => {
  return new Promise((resolve, reject) => {
    uni.request(requestInterceptor(config)).then(res => {
      resolve(responseInterceptor(res));
    }).catch(err => {
      reject(err);
    });
    const config = {}
    axios({
      method: 'get',
      url: 'https://api.example.com/data',
      timeout: 1000,
      headers: {'X-Custom-Header': 'foobar'}
    })
      .then(function (response) {
        console.log(response.data);
      })
      .catch(function (error) {
        console.log(error);
      });
  })
}
